<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //ES6允许按照一定模式从数组和对象中提取值 对变量进行赋值
        //解构赋值
        // 1.数组结构
        const arr = ['123', '456', '789']

        let [TEST1, TEST2, TEST3] = arr

        console.log([TEST1, TEST2, TEST3]);


        //2.对象解构赋值
        const zhao = {
            name: 'lili',
            age: 20,
            sex: function () {
                console.log('测试解构赋值');
            }
        }
        let { name, age, sex } = zhao
        console.log({ name, age, sex });



    </script>
</body>

</html>